FROM golang:1.14.2-alpine3.11 as builder

RUN apk add git
RUN mkdir -p /var/www/go-papers
WORKDIR /var/www/go-papers

COPY . .

WORKDIR /var/www/go-papers
RUN GO111MODULE=off CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /go/bin/app

FROM scratch
COPY --from=builder /go/bin/app /go/bin/app
COPY .config /config
ENTRYPOINT ["go/bin/app", "server --env", "local"]
